using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The StandardLevelCourseTableManager class is responsible for managing BO.StandardLevelCourseTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class StandardLevelCourseTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all StandardLevelCourseTable objects in the database.
/// </summary>
/// <returns>A list with all StandardLevelCourseTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static StandardLevelCourseTableList GetList(){
return StandardLevelCourseTableDB.GetList();
}

/// <summary>
/// Gets a single StandardLevelCourseTable from the database without its data.
/// </summary>
/// <param name="courseKey">The CourseKey of the StandardLevelCourseTable in the database.</param>
/// <returns>A StandardLevelCourseTable object when the CourseKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static StandardLevelCourseTable GetItem(int courseKey){
return GetItem(courseKey, false);
}

/// <summary>
/// Gets a single StandardLevelCourseTable from the database.
/// </summary>
/// <param name="courseKey">The CourseKey of the StandardLevelCourseTable in the database.</param>
/// <param name="getStandardLevelCourseTableRecords">Determines whether to load all associated StandardLevelCourseTable records as well.</param>
/// <returns>
/// A StandardLevelCourseTable object when the CourseKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static StandardLevelCourseTable GetItem(int courseKey, bool getStandardLevelCourseTableRecords){
StandardLevelCourseTable myStandardLevelCourseTable = StandardLevelCourseTableDB.GetItem(courseKey);
return myStandardLevelCourseTable;
}

/// <summary>
/// Saves a StandardLevelCourseTable in the database.
/// </summary>
/// <param name="myStandardLevelCourseTable">The StandardLevelCourseTable instance to save.</param>
/// <returns>The new CourseKey if the StandardLevelCourseTable is new in the database or the existing CourseKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(StandardLevelCourseTable myStandardLevelCourseTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int standardLevelCourseTableCourseKey = StandardLevelCourseTableDB.Save(myStandardLevelCourseTable);

//  Assign the StandardLevelCourseTable its new (or existing CourseKey).
myStandardLevelCourseTable.CourseKey = standardLevelCourseTableCourseKey;

myTransactionScope.Complete();

return standardLevelCourseTableCourseKey;
}
}

/// <summary>
/// Deletes a StandardLevelCourseTable from the database.
/// </summary>
/// <param name="myStandardLevelCourseTable">The StandardLevelCourseTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(StandardLevelCourseTable myStandardLevelCourseTable){
return StandardLevelCourseTableDB.Delete(myStandardLevelCourseTable.CourseKey);
}

#endregion

}

}
